package com.ht.sps.util;

import org.nutz.json.Json;
import org.nutz.lang.Lang;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * json工具类
 * User: 董良伟
 * Date: 13-10-25
 * Time: 下午2:39
 * To change this template use File | Settings | File Templates.
 */
public class JsonUtil {
    /**
     * JSON字符串转成List<?>
     * @param T
     * @param cs
     * @return
     */
    public static List fromJson(Class<?> T,CharSequence cs){
        List<Map> maps = (List<Map>) Json.fromJson(cs);
        List list = new ArrayList();
        for (Map map : maps) {
            Object obj = Lang.map2Object(map, T);
            list.add(obj);
        }
        return list;
    }
}
